package com.ai.bitcoin.jpa.dao;

import com.ai.bitcoin.jpa.entity.RedeemCode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface RedeemCodeDao extends JpaRepository<RedeemCode, String> {

    RedeemCode findByCode(String code);

    @Query(nativeQuery = true,value = "update redeem_code set status = ?1 WHERE  status in (1,2) and id = ?2")
    @Modifying
    int updateStatusById(Integer status,String id);

}
